Skip to content

Add DLM force merge operation helpers#143200

Merged
seanzatzdev merged 22 commits intoelastic:mainfrom
seanzatzdev:dlm-force-merge-operation
Mar 6, 2026
Merged

Add DLM force merge operation helpers#143200
seanzatzdev merged 22 commits intoelastic:mainfrom
seanzatzdev:dlm-force-merge-operation

Conversation

@seanzatzdev
Copy link
Copy Markdown
Contributor

@seanzatzdev seanzatzdev commented Feb 27, 2026

This PR adds some helpers to perform the actual deduplicated DLM force merge, and removes some extraneous testing per feedback on a previous PR

For the most part, this code just adapts the existing logic from data lifecycle service. there is some duplication due to this in order to avoid further refactors

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds helper methods to perform deduplicated DLM force merge operations within the ForceMergeStep class, and removes a test for the step name per prior feedback. The changes move force merge logic from a centralized service pattern to a more distributed step-based pattern, where each step handles its own force merge execution through the DlmStepContext deduplication framework.

Changes:

  • Added maybeForceMerge and forceMerge helper methods to ForceMergeStep for executing deduplicated force merge operations
  • Made ForceMergeRequestWrapper class and constructor public to allow usage from ForceMergeStep
  • Removed extraneous testStepName test and added comprehensive tests for the new force merge methods

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
ForceMergeStep.java Added helper methods (maybeForceMerge, forceMerge, formForceMergeRequest) to handle deduplicated force merge execution with error handling and logging
DataStreamLifecycleService.java Changed ForceMergeRequestWrapper visibility from package-private to public to enable usage outside the service class
ForceMergeStepTests.java Removed testStepName test and added comprehensive tests for the new force merge functionality including success, failure, and error recording scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@seanzatzdev seanzatzdev marked this pull request as ready for review February 27, 2026 04:34
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@seanzatzdev
Copy link
Copy Markdown
Contributor Author

Decided to just add the execute() implementation to this one since it was just a line and this PR is still short

seanzatzdev and others added 2 commits March 2, 2026 11:07
…ms/lifecycle/transitions/steps/ForceMergeStep.java

Co-authored-by: Luke Whiting <luke.whiting@elastic.co>
Copy link
Copy Markdown
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a comment about handling unhealthy indices.

@seanzatzdev seanzatzdev requested a review from dakrone March 4, 2026 20:55
Copy link
Copy Markdown
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for iterating on this Sean!

@seanzatzdev seanzatzdev merged commit 294a8b0 into elastic:main Mar 6, 2026
34 checks passed
@seanzatzdev seanzatzdev deleted the dlm-force-merge-operation branch March 6, 2026 05:20
spinscale pushed a commit to spinscale/elasticsearch that referenced this pull request Mar 6, 2026
* Add DLM force merge operation helpers

* adapt data lifecycleservice force merge code

* Update modules/data-streams/src/main/java/org/elasticsearch/datastreams/lifecycle/transitions/steps/ForceMergeStep.java

Co-authored-by: Luke Whiting <luke.whiting@elastic.co>

* PR feedback

* [CI] Auto commit changes from spotless

* implement execute(), add completeness check before running maybeForceMerge()

* add unit test for when force merge is already complete

* add check for nonexistent index

* update comment

* Update modules/data-streams/src/main/java/org/elasticsearch/datastreams/lifecycle/transitions/steps/ForceMergeStep.java

Co-authored-by: Luke Whiting <luke.whiting@elastic.co>

* [CI] Auto commit changes from spotless

* Update modules/data-streams/src/main/java/org/elasticsearch/datastreams/lifecycle/transitions/steps/ForceMergeStep.java

Co-authored-by: Lee Hinman <dakrone@users.noreply.github.com>

* respond to PR feedback

* use unavailable shards method

* address PR feedback

* adjust to max timeout for force merge

---------

Co-authored-by: Luke Whiting <luke.whiting@elastic.co>
Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: Lee Hinman <dakrone@users.noreply.github.com>
sidosera pushed a commit to sidosera/elasticsearch that referenced this pull request Mar 6, 2026
* Add DLM force merge operation helpers

* adapt data lifecycleservice force merge code

* Update modules/data-streams/src/main/java/org/elasticsearch/datastreams/lifecycle/transitions/steps/ForceMergeStep.java

Co-authored-by: Luke Whiting <luke.whiting@elastic.co>

* PR feedback

* [CI] Auto commit changes from spotless

* implement execute(), add completeness check before running maybeForceMerge()

* add unit test for when force merge is already complete

* add check for nonexistent index

* update comment

* Update modules/data-streams/src/main/java/org/elasticsearch/datastreams/lifecycle/transitions/steps/ForceMergeStep.java

Co-authored-by: Luke Whiting <luke.whiting@elastic.co>

* [CI] Auto commit changes from spotless

* Update modules/data-streams/src/main/java/org/elasticsearch/datastreams/lifecycle/transitions/steps/ForceMergeStep.java

Co-authored-by: Lee Hinman <dakrone@users.noreply.github.com>

* respond to PR feedback

* use unavailable shards method

* address PR feedback

* adjust to max timeout for force merge

---------

Co-authored-by: Luke Whiting <luke.whiting@elastic.co>
Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: Lee Hinman <dakrone@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants